// https://leetcode.cn/problems/remove-element/description/?envType=study-plan-v2&envId=top-interview-150

class Solution {
    public:
        int removeElement(vector<int>& nums, int val) {
            int i = 0;
            for (int j = 0; j < nums.size(); j++) {
                if (nums[j] != val) {
                    nums[i] = nums[j];
                    i++;
                }
            }
            return i;
        }
    };